package design.mode.effective_java.chapter2.item2.pizza;

/**
 * @author mingde
 * @date 2021/8/2 23:32
 * @describe calzone 而后者让你指定酱料应该放在里面还是外面
 */
public class Calzone extends Pizza{

    private final boolean sauceInside;

    public static class Builder extends Pizza.Builder<Builder>{
        private boolean sauceInside = false;

        public Builder sauceInside(){
            sauceInside = true;
            return this;
        }

        @Override
        public Calzone build() { // 协变返回类型
            return new Calzone(this);
        }

        @Override
        protected Builder self() {
            return this;
        }
    }

    private Calzone(Builder builder) {
        super(builder);
        sauceInside = builder.sauceInside;
    }


}
